package com.example.hcbmsm.controller;

import com.example.hcbmsm.domain.Reg;
import com.example.hcbmsm.service.RegService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author Xinghm
 * @version 1.0
 * @since 2024/10/29 22:57
 */
@RestController
@CrossOrigin
@RequestMapping("/reg")
public class RegController {
    @Autowired
    private RegService regService;
    @GetMapping("/list")
    public Map findAllReg(String token) {
        return regService.findAllReg(token);
    }
    @PostMapping("/add")
    public Map add(String token, @RequestBody Reg reg) {
        return regService.add(token, reg);
    }
    @PostMapping("/renewBYOpId")
    public Map renewBYOpId(String token, @RequestBody Reg reg) {
        return regService.renewBYOpId(token, reg);
    }
    @PostMapping("/renew")
    public Map renew(String token, @RequestBody Reg reg) {
        return regService.renew(token, reg);
    }
    @PostMapping("/remove")
    public Map remove(Long regId) {
        return regService.remove(regId);
    }
}
